{ From user A Lumens, Project Swapping at Tue, Aug 10, 1993 2:52 PM}
{ System Variables with non-default values: }
Typechecking := 1
Checking := 1
Saveoptions := 2
Savevalues := 0
{ Non-default Time SysVar value: }
Time := [0,1,2]
Project Swapping
Title: Swapping y and x-index
Description: This model demonstrates how to swap a computed or one-dimensional table value with its Index (thus making the computed value an index).
Author: A Lumens
Date: Mon, Aug 9, 1993 12:05 PM
Saveauthor: A Lumens
Savedate: Tue, Aug 10, 1993 2:52 PM
Defaultsize: 48,20
Diagstate: 1,40,50,443,196,3
Fileinfo: 0,-5,6752,Project Swapping,Swapping y and x-index
Getresource
Index X
Title: x
Description: A set of alternative values representing an Index.
Definition: [1,2,5]
Location: 72,56
Nodesize: 48,20
Windstate: 1,157,150
Valuestate: 1,168,178,268,137,0,MIDM
Chance Y_of_x
Title: y = f(x)
Description: Some function of x, or a table indexed by x (in this example, a table indexed by x).
Definition: Table(X)(
5,20,30)
Location: 72,120
Nodesize: 48,20
Windstate: 1,129,162
Defnstate: 1,110,367,416,303,0,MIDM
Valuestate: 1,113,209,289,137,0,MIDM
Index Y
Title: y
Description: Extracts the values of z_of_x to generate an Index.~
~
It iterates across the length of index x, using the sequence function (which will generate an un-indexed array), and slicing out each value of z_of_x. Because Sequence generates an array, Demos treats the result for z as an Index.
Definition: Using i := Sequence(1,Size(X)) Do Slice(Y_of_x,X,i)
Location: 200,120
Nodesize: 48,20
Windstate: 1,185,182
Valuestate: 1,205,210,242,137,0,MIDM
Chance X_of_y
Title: x = f(y)
Description: This creates an Array using x as the values, and assigning y as the Index. As long as these are the same length, Demos will make the assignment.